package cn.fengzhilun.javase.javafx.control;

import javafx.application.Application;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.stage.Stage;

public class DemoButton extends Application {

	@Override
	public void start(Stage primaryStage) throws Exception {
		//创建场景，往场景里添加组件
		Scene scene = new Scene(GreateUi());
		//将场景添加到舞台上
		primaryStage.setScene(scene);
		//将场景展示。
		primaryStage.show();
	}

	private Parent GreateUi() {
		 Button button = new Button();
		 
		 Image image = new Image(getClass().getResourceAsStream("new.png"));
		 ImageView view = new ImageView(image);
		
		 button.setGraphic(view);
		 
		 
		return button;
	}
	
	public static void main(String[] args) {
		Application.launch(args);
	}
}
